home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
spcfont.zip
/
SPCFONT.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1992-06-20
|
7KB
|
211 lines
Unit SPCFont;
{
Unit SPCFont created by Max Maischein, 2:246/6.17, 20.06.92
This unit replaces the characters #1, #2, #3, #4 and #5 with
Norton-style box and copyright chars. They do not look quite the way,
Nortons do because I did not want to use the line-drawing chars.
So, if you look closely, you can see a fine line between the cross-
encasing lines. Well, I do not care, since it is just a small
inconvenience.
If no VGA is found, the text equivalents to the remapped chars
will be used.
CAVEATS:
- The chars #01 through #05 are used, so you cannot use them anymore.
- If you shell out to another program or if your program terminates,
clear the screen and remove all 'buttons' and 'copyrights', since
they will revert to their previous look if you UnInstall the charset.
- If you already have redefined the chars #01 through #05, they will
be thrashed. Bad luck !
}
Interface
Type String3 = String[ 3 ];
Function Button( State : Boolean ) : String3;
{ Returns the string for a checkbox, if state is true with checkmark. }
Procedure InstallCharset;
{ Installs the new font, remapping chars #01 - #05 }
Procedure UnInstallCharSet;
{ Removes the new font, restoring the original VGA font }
Function CopyRight : String3;
{ returns the string for a copyright "(c)" }
Implementation
CONST ButtonOffString : String = '[ ]'; { these are the strings returned }
ButtonOnString : String = '[■]'; { if the program runs on a nonVGA }
CopyRightString : String = '(c)'; { system. }
Procedure FontData;
{ The data for the new font. It is declared as a dummy procedure,
so no space is used in the data segment. }
Assembler;
Asm
{ #1 } db 000h, 007h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 007h, 007h, 000h, 000h
{ #2 } db 000h, 0E0h, 020h, 020h, 020h, 020h, 020h, 020h, 020h, 020h, 020h, 020h, 0E0h, 0E0h, 000h, 000h
{ #3 } db 000h, 0FFh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0FFh, 0FFh, 000h, 000h
{ #4 } db 000h, 0FFh, 000h, 081h, 0C3h, 066h, 03Ch, 03Ch, 066h, 0C3h, 081h, 000h, 0FFh, 0FFh, 000h, 000h
{ #5 } db 000h, 000h, 000h, 03Ch, 042h, 099h, 0A5h, 0A1h, 0A5h, 099h, 042h, 03Ch, 000h, 000h, 000h, 000h
End;
Procedure OldFont;
{ The data of the original VGA font. If you don't like this, you will
have to change the data ;-) }
Assembler;
Asm
db 000h, 000h, 07Eh, 081h, 0A5h, 081h, 081h, 0BDh, 099h, 081h, 081h, 07Eh, 000h, 000h, 000h, 000h
db 000h, 000h, 07Eh, 0FFh, 0DBh, 0FFh, 0FFh, 0C3h, 0E7h, 0FFh, 0FFh, 07Eh, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 06Ch, 0FEh, 0FEh, 0FEh, 0FEh, 07Ch, 038h, 010h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 010h, 038h, 07Ch, 0FEh, 07Ch, 038h, 010h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 018h, 03Ch, 03Ch, 0E7h, 0E7h, 0E7h, 018h, 018h, 03Ch, 000h, 000h, 000h, 000h
End;
Function CopyRight : String3;
Begin
CopyRight := CopyRightString;
End;
Function Button( State : Boolean ) : String3;
Begin
If State
then Button := ButtonOnString
else Button := ButtonOffString
End;
Function VGAAvail : Boolean; { determines, if a VGA is present }
Assembler;
{INT 10 - VIDEO - GET INDIVIDUAL PALETTE REGISTER (VGA)}
Asm
mov ax, 1007h
xor bx, bx
int 10h
jc @NoVGA
mov al, 1
ret
@NoVGA:
xor ax, ax
ret
End;
Function HercAvail : Boolean; { determines, wether hercules mode ( 7 ) is active or not }
Assembler;
Asm
mov ax, 0040h
mov es, ax
mov al, es:[ 49h ] { BIOS segment : 49h -> current videomode }
cmp al, 7 { mode 7 ( Hercules ) ? }
je @HercMode { yes, return true }
mov al, 6 { no, set up al for false / 0 }
@HercMode:
sub al, 6 { al = 7 or 6, so this will give 1 or 0 }
ret
End;
Procedure InstallCharset;
Begin
If not HercAvail AND VGAAvail
then
Begin
Asm;
push bp
mov si, 40h
mov es, si
mov ax, es:[ 60h ]
push ax { save old cursor style on stack }
mov ax, seg FontData
mov es, ax
mov ax, 1100h { Load userdefined charset }
mov bx, 1000h { bh = bytes per char ( 10h ); bl = page ( 0h ) }
mov cx, 0005h { number of patterns }
mov dx, 0001h { dx = first char }
mov bp, offset FontData { es:bp -> new char table }
int 10h { install the new chars }
mov ah, 12h
mov bh, 20h
int 10h { and set up the printscreen procedure }
mov ax,0100h
pop cx { get the old cursor style }
int 10h { and restore it }
pop bp { restore bp }
End;
ButtonOffString := #01#03#02; { and set up the strings }
ButtonOnString := #01#04#02;
CopyRightString := #32#05#32;
End
Else
Begin
ButtonOffString := '[ ]';
ButtonOnString := '[X]';
CopyRightString := '(c)';
End;
End;
Procedure UnInstallCharSet;
Begin
If VGAAvail
then
Asm
push bp
mov si, 40h
mov es, si
mov ax, es:[ 60h ]
push ax { save old cursor style on stack }
mov ax, seg OldFont
mov es, ax
mov ax, 1100h { Load userdefined charset }
mov bx, 1000h { bh = bytes per char ( 10h ); bl = page ( 0h ) }
mov cx, 0005h { number of patterns }
mov dx, 0001h { dx = first char }
mov bp, offset OldFont { es:bp -> new char table }
int 10h { install the new chars }
mov ah, 12h
mov bh, 20h
int 10h { and set up the printscreen procedure }
mov ax,0100h
pop cx { get the old cursor style }
int 10h { and restore it }
pop bp { restore bp }
End;
ButtonOffString := '[ ]';
ButtonOnString := '[X]';
CopyRightString := '(c)';
End;
End.